
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>kotlin基础 · Aivin开发笔记</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="Aivin">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-tbfed-pagefooter/footer.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-donate/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-local-video/video-js.min.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-theme-comscore/test.css">
                
            
        

    

    
        
        <link rel="stylesheet" href="../styles/website.css">
        
    

        
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    
    <link rel="prev" href="../" />
    

    
        <link rel="shortcut icon" href='../assets/images/favicon.ico' type="image/x-icon">
    
    
        <link rel="bookmark" href='../assets/images/favicon.ico' type="image/x-icon">
    
    
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    个人信息
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2" data-path="kotlin基础.html">
            
                <a href="kotlin基础.html">
            
                    
                    kotlin基础
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >kotlin基础</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#kotlin"><b>1. </b>kotlin</a></li><ul><li><span class="title-icon "></span><a href="#&#x6570;&#x636E;&#x7C7B;&#x578B;"><b>1.1. </b>&#x6570;&#x636E;&#x7C7B;&#x578B;</a></li><li><span class="title-icon "></span><a href="#&#x53D8;&#x91CF;-&#x3001;&#x5E38;&#x91CF;"><b>1.2. </b>&#x53D8;&#x91CF; &#x3001;&#x5E38;&#x91CF;</a></li><li><span class="title-icon "></span><a href="#&#x51FD;&#x6570;"><b>1.3. </b>&#x51FD;&#x6570;</a></li><li><span class="title-icon "></span><a href="#&#x5B57;&#x7B26;&#x4E32;&#x6A21;&#x677F;"><b>1.4. </b>&#x5B57;&#x7B26;&#x4E32;&#x6A21;&#x677F;</a></li><li><span class="title-icon "></span><a href="#&#x7A7A;&#x6307;&#x9488;"><b>1.5. </b>&#x7A7A;&#x6307;&#x9488;</a></li><li><span class="title-icon "></span><a href="#&#x7C7B;&#x578B;&#x8F6C;&#x6362;"><b>1.6. </b>&#x7C7B;&#x578B;&#x8F6C;&#x6362;</a></li><li><span class="title-icon "></span><a href="#&#x5BF9;&#x8C61;"><b>1.7. </b>&#x5BF9;&#x8C61;</a></li><li><span class="title-icon "></span><a href="#&#x63A5;&#x53E3;"><b>1.8. </b>&#x63A5;&#x53E3;</a></li><li><span class="title-icon "></span><a href="#&#x5B89;&#x5353;&#x4F7F;&#x7528;-kotlin"><b>1.9. </b>&#x5B89;&#x5353;&#x4F7F;&#x7528; kotlin</a></li><ul><li><span class="title-icon "></span><a href="#&#x7C7B;&#x521D;&#x59CB;&#x5316;"><b>1.9.1. </b>&#x7C7B;&#x521D;&#x59CB;&#x5316;</a></li><li><span class="title-icon "></span><a href="#apply"><b>1.9.2. </b>apply</a></li><li><span class="title-icon "></span><a href="#with"><b>1.9.3. </b>with</a></li></ul><li><span class="title-icon "></span><a href="#when"><b>1.10. </b>when</a></li><ul><li><span class="title-icon "></span><a href="#intarrayof"><b>1.10.1. </b>intArrayOf</a></li><li><span class="title-icon "></span><a href="#&#x4F4D;&#x8FD0;&#x7B97;&#x7B26;"><b>1.10.2. </b>&#x4F4D;&#x8FD0;&#x7B97;&#x7B26;</a></li><li><span class="title-icon "></span><a href="#companion-object"><b>1.10.3. </b>companion object</a></li><li><span class="title-icon "></span><a href="#let"><b>1.10.4. </b>let</a></li><li><span class="title-icon "></span><a href="#&#x53CC;&#x5192;&#x53F7;-"><b>1.10.5. </b>&#x53CC;&#x5192;&#x53F7; ::</a></li></ul></ul></ul></div><a href="#kotlin" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="kotlin"><a name="kotlin" class="anchor-navigation-ex-anchor" href="#kotlin"><i class="fa fa-link" aria-hidden="true"></i></a>1. kotlin</h1>
<p>Kotlin&#x662F;JetBrains &#x5F00;&#x53D1;&#x7684;&#x57FA;&#x4E8E;JVM&#x7684;&#x8BED;&#x8A00;</p>
<h2 id="&#x6570;&#x636E;&#x7C7B;&#x578B;"><a name="&#x6570;&#x636E;&#x7C7B;&#x578B;" class="anchor-navigation-ex-anchor" href="#&#x6570;&#x636E;&#x7C7B;&#x578B;"><i class="fa fa-link" aria-hidden="true"></i></a>1.1. &#x6570;&#x636E;&#x7C7B;&#x578B;</h2>
<pre><code class="lang-java">Byte&#x3001;Short&#x3001;Int&#x3001;Long&#x3001;Float&#x3001;Double &#x3001;Boolean &#x3001;String
</code></pre>
<h2 id="&#x53D8;&#x91CF;-&#x3001;&#x5E38;&#x91CF;"><a name="&#x53D8;&#x91CF;-&#x3001;&#x5E38;&#x91CF;" class="anchor-navigation-ex-anchor" href="#&#x53D8;&#x91CF;-&#x3001;&#x5E38;&#x91CF;"><i class="fa fa-link" aria-hidden="true"></i></a>1.2. &#x53D8;&#x91CF; &#x3001;&#x5E38;&#x91CF;</h2>
<pre><code class="lang-java">var value : Int = <span class="hljs-number">10</span>   <span class="hljs-comment">// &#x53D8;&#x91CF;</span>
val name  : String =<span class="hljs-string">&quot;abcdedfdfa&quot;</span>   <span class="hljs-comment">// &#x5E38;&#x91CF;</span>
</code></pre>
<h2 id="&#x51FD;&#x6570;"><a name="&#x51FD;&#x6570;" class="anchor-navigation-ex-anchor" href="#&#x51FD;&#x6570;"><i class="fa fa-link" aria-hidden="true"></i></a>1.3. &#x51FD;&#x6570;</h2>
<pre><code class="lang-java"><span class="hljs-comment">// fun ,&#x6709;&#x53C2;&#x6570; &#xFF0C;&#x6709;&#x8FD4;&#x56DE;&#x503C;</span>
<span class="hljs-function">fun <span class="hljs-title">sum</span><span class="hljs-params">(a: Int, b: Int)</span>: String </span>{
    <span class="hljs-keyword">return</span> (a + b).toString()
}

<span class="hljs-comment">// &#x65E0;&#x8FD4;&#x56DE;&#x503C;</span>
<span class="hljs-function">fun <span class="hljs-title">showInfo</span><span class="hljs-params">(a: Int, b: Int)</span></span>{
}

<span class="hljs-comment">// vararg &#x53EF;&#x53D8;&#x957F;&#x53C2;&#x6570;</span>
<span class="hljs-function">fun <span class="hljs-title">vars</span><span class="hljs-params">(vararg v:Int)</span></span>{
    <span class="hljs-keyword">for</span>(vt in v){
        <span class="hljs-comment">//...</span>
    }
}
</code></pre>
<h2 id="&#x5B57;&#x7B26;&#x4E32;&#x6A21;&#x677F;"><a name="&#x5B57;&#x7B26;&#x4E32;&#x6A21;&#x677F;" class="anchor-navigation-ex-anchor" href="#&#x5B57;&#x7B26;&#x4E32;&#x6A21;&#x677F;"><i class="fa fa-link" aria-hidden="true"></i></a>1.4. &#x5B57;&#x7B26;&#x4E32;&#x6A21;&#x677F;</h2>
<pre><code class="lang-java">val age  :Int = <span class="hljs-number">20</span>
var info :String =<span class="hljs-string">&quot;&#x5E74;&#x9F84;&#x662F;$age&quot;</span>
<span class="hljs-comment">//&#x590D;&#x6742;&#x683C;&#x5F0F;</span>
var info2 = <span class="hljs-string">&quot;$info &#x5B57;&#x7B26;&#x4E32;&#x957F;&#x5EA6;&#x662F;${info.length}&quot;</span>
</code></pre>
<h2 id="&#x7A7A;&#x6307;&#x9488;"><a name="&#x7A7A;&#x6307;&#x9488;" class="anchor-navigation-ex-anchor" href="#&#x7A7A;&#x6307;&#x9488;"><i class="fa fa-link" aria-hidden="true"></i></a>1.5. &#x7A7A;&#x6307;&#x9488;</h2>
<p>kotlin&#x53EA;&#x662F;&#x5728;&#x7F16;&#x8BD1;&#x7684;&#x65F6;&#x5019;&#x52A0;&#x5F3A;&#x4E86;&#x7A7A;&#x6307;&#x9488;&#x7684;&#x68C0;&#x67E5;&#xFF0C;&#x6700;&#x540E;&#x8FD8;&#x662F;&#x8981;&#x5224;&#x65AD;&#x662F;&#x5426;&#x4E3A;&#x7A7A;&#x624D;&#x80FD;&#x6700;&#x7EC8;&#x4F7F;&#x7528;&#x3002;&#x5375;&#x7528;&#x3002;</p>
<pre><code class="lang-java"><span class="hljs-comment">//?&#x8868;&#x793A;&#x53EF;&#x4E3A;null</span>
var ageString : String ?
<span class="hljs-comment">//  ?.  student &#x4E3A;&#x7A7A;&#x5C31;&#x8FD4;&#x56DE;null &#xFF0C;&#x4E0D;&#x662F;&#x7A7A; &#x5C31;&#x8FD4;&#x56DE; &#x5BF9;&#x5E94;&#x7684;&#x503C;</span>
<span class="hljs-comment">// &#x53EA;&#x80FD;&#x8D4B;&#x503C;&#x7ED9; &#x53EF;&#x4EE5;&#x4E3A;&#x7A7A;&#x7684;&#x53D8;&#x91CF;</span>
ageString =student ?. name

<span class="hljs-comment">// ?:  ageString &#x4E3A;&#x7A7A;&#x5C31;&#x7528;&#x9ED8;&#x8BA4;&#x503C; &#xFF0C;&#x5426;&#x5219;&#x7528;&#x53D6;&#x5F97;&#x7684;&#x503C;</span>
var info :String?
info =  ageString ?:  <span class="hljs-string">&quot;21&quot;</span>

<span class="hljs-comment">// !!  &#x975E;&#x7A7A;&#x65AD;&#x8A00; ageString&#x4E0D;&#x4E3A;&#x7A7A;&#x65F6;&#x83B7;&#x53D6;&#x5BF9;&#x5E94;&#x7684;&#x503C; &#xFF0C;&#x5426;&#x5219;&#x76F4;&#x63A5;&#x62A5;&#x9519; &#x3002;</span>
<span class="hljs-comment">// &#x4E0D;&#x5EFA;&#x8BAE;&#x4F7F;&#x7528; &#x8FD9;&#x79CD;&#x65B9;&#x5F0F;</span>
val length : Int  = ageString!!.length

<span class="hljs-comment">// &#x5224;&#x65AD;&#x662F;&#x5426;&#x4E3A;&#x7A7A;</span>
var flag : Boolean = ageString.isNullOrBlank()
</code></pre>
<h2 id="&#x7C7B;&#x578B;&#x8F6C;&#x6362;"><a name="&#x7C7B;&#x578B;&#x8F6C;&#x6362;" class="anchor-navigation-ex-anchor" href="#&#x7C7B;&#x578B;&#x8F6C;&#x6362;"><i class="fa fa-link" aria-hidden="true"></i></a>1.6. &#x7C7B;&#x578B;&#x8F6C;&#x6362;</h2>
<pre><code class="lang-java">var info : String = <span class="hljs-string">&quot;100&quot;</span>
var info2 :Int = info.toInt()
var info3 :String = info2.toString()
</code></pre>
<h2 id="&#x5BF9;&#x8C61;"><a name="&#x5BF9;&#x8C61;" class="anchor-navigation-ex-anchor" href="#&#x5BF9;&#x8C61;"><i class="fa fa-link" aria-hidden="true"></i></a>1.7. &#x5BF9;&#x8C61;</h2>
<p>&#x6240;&#x6709;&#x7684;&#x7C7B;&#x90FD;&#x7EE7;&#x627F;&#x81EA; Any &#x3002;
&#x9ED8;&#x8BA4;&#x6240;&#x6709;&#x7684;&#x7C7B;&#x90FD;&#x662F;final&#x7C7B;&#x578B; &#x3002;</p>
<pre><code class="lang-java"><span class="hljs-comment">// (info: String) &#x662F;&#x4E3B;&#x6784;&#x65B9;&#x6CD5;</span>
<span class="hljs-function">open  class <span class="hljs-title">Person</span>  <span class="hljs-params">(info: String)</span></span>{
   <span class="hljs-comment">// &#x53EF;&#x4EE5;&#x88AB;&#x91CD;&#x5199;</span>
   open var info : String =<span class="hljs-string">&quot;&#x4EBA;&#x7C7B;&quot;</span>
   var age1 : Int = <span class="hljs-number">25</span>

   <span class="hljs-comment">// &#x6B21;&#x6784;&#x9020;&#x51FD;&#x6570;</span>
  constructor(info: String  ,age: Int) : <span class="hljs-keyword">this</span>(info) {
       <span class="hljs-keyword">this</span>. info = info
       <span class="hljs-keyword">this</span>.age1 = age
   }
   <span class="hljs-comment">// &#x666E;&#x901A;&#x51FD;&#x6570; open  ,&#x53EF;&#x4EE5;&#x88AB;&#x91CD;&#x65B0;</span>
   <span class="hljs-function">open fun <span class="hljs-title">showInfo</span><span class="hljs-params">()</span></span>{
   }

   <span class="hljs-comment">// &#x666E;&#x901A;&#x51FD;&#x6570; open  ,&#x4E0D;&#x53EF;&#x4EE5;&#x88AB;&#x91CD;&#x65B0;</span>
   <span class="hljs-function">fun <span class="hljs-title">showInfo2</span><span class="hljs-params">()</span></span>{
   }
}

<span class="hljs-function"><span class="hljs-keyword">public</span> class <span class="hljs-title">Student</span><span class="hljs-params">(info: String)</span> : <span class="hljs-title">Person</span><span class="hljs-params">(info)</span> </span>{
    override var info : String =info

    <span class="hljs-comment">// &#x6B21;&#x6784;&#x9020;&#x51FD;&#x6570;</span>
    constructor(info: String  ,age: Int) : <span class="hljs-keyword">this</span>(info) {
        <span class="hljs-keyword">this</span>. info = info
        <span class="hljs-keyword">this</span>.age1 = age
    }

    <span class="hljs-comment">// override &#x91CD;&#x5199;&#x51FD;&#x6570;</span>
    <span class="hljs-function">override fun <span class="hljs-title">showInfo</span><span class="hljs-params">()</span> </span>{
        <span class="hljs-keyword">super</span>.showInfo()
    }

}

<span class="hljs-comment">// &#x6D4B;&#x8BD5;</span>
var student1 : Student = Student(<span class="hljs-string">&quot;&#x65B0;&#x4EBA;&#x7C7B;&quot;</span>  ,<span class="hljs-number">19</span>)
var student2 : Student = Student(<span class="hljs-string">&quot;&#x65B0;&#x4EBA;&#x7C7B;&quot;</span>   )
</code></pre>
<h2 id="&#x63A5;&#x53E3;"><a name="&#x63A5;&#x53E3;" class="anchor-navigation-ex-anchor" href="#&#x63A5;&#x53E3;"><i class="fa fa-link" aria-hidden="true"></i></a>1.8. &#x63A5;&#x53E3;</h2>
<pre><code class="lang-java"><span class="hljs-class"><span class="hljs-keyword">interface</span>  <span class="hljs-title">Language</span>  </span>{
    <span class="hljs-function">fun <span class="hljs-title">chinease</span><span class="hljs-params">(msg :String )</span>
    fun <span class="hljs-title">english</span><span class="hljs-params">(msg :String )</span>
}

<span class="hljs-comment">// Person &#x662F;&#x7236;&#x7C7B; &#xFF0C; Language&#x662F;&#x63A5;&#x53E3;</span>
<span class="hljs-keyword">public</span> class <span class="hljs-title">Student</span><span class="hljs-params">(info: String)</span> : <span class="hljs-title">Person</span><span class="hljs-params">(info)</span>,Language</span>{
    <span class="hljs-function">override fun <span class="hljs-title">english</span><span class="hljs-params">(msg: String)</span> </span>{
    }

    <span class="hljs-function">override fun <span class="hljs-title">chinease</span><span class="hljs-params">(msg: String)</span> </span>{
    }
    ....
}
</code></pre>
<h2 id="&#x5B89;&#x5353;&#x4F7F;&#x7528;-kotlin"><a name="&#x5B89;&#x5353;&#x4F7F;&#x7528;-kotlin" class="anchor-navigation-ex-anchor" href="#&#x5B89;&#x5353;&#x4F7F;&#x7528;-kotlin"><i class="fa fa-link" aria-hidden="true"></i></a>1.9. &#x5B89;&#x5353;&#x4F7F;&#x7528; kotlin</h2>
<h3 id="&#x7C7B;&#x521D;&#x59CB;&#x5316;"><a name="&#x7C7B;&#x521D;&#x59CB;&#x5316;" class="anchor-navigation-ex-anchor" href="#&#x7C7B;&#x521D;&#x59CB;&#x5316;"><i class="fa fa-link" aria-hidden="true"></i></a>1.9.1. &#x7C7B;&#x521D;&#x59CB;&#x5316;</h3>
<pre><code class="lang-java">kotlin&#x589E;&#x52A0;&#x4E86;&#x4E00;&#x4E2A;&#x65B0;&#x7684;&#x5173;&#x952E;&#x5B57;init&#x7528;&#x6765;&#x5904;&#x7406;&#x7C7B;&#x7684;&#x521D;&#x59CB;&#x5316;&#x95EE;&#x9898;&#xFF0C;
init&#x6A21;&#x5757;&#x4E2D;&#x7684;&#x5185;&#x5BB9;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x4F7F;&#x7528;&#x6784;&#x9020;&#x51FD;&#x6570;&#x7684;&#x53C2;&#x6570;&#x3002;
</code></pre>
<h3 id="apply"><a name="apply" class="anchor-navigation-ex-anchor" href="#apply"><i class="fa fa-link" aria-hidden="true"></i></a>1.9.2. apply</h3>
<pre><code class="lang-java">&#x8C03;&#x7528;&#x5BF9;&#x8C61;&#x7684;apply&#x51FD;&#x6570;&#xFF0C;&#x5728;&#x51FD;&#x6570;&#x8303;&#x56F4;&#x5185;&#xFF0C;&#x53EF;&#x4EE5;&#x4EFB;&#x610F;&#x8C03;&#x7528;&#x8BE5;&#x5BF9;&#x8C61;&#x7684;&#x4EFB;&#x610F;&#x65B9;&#x6CD5;&#xFF0C;&#x5E76;&#x8FD4;&#x56DE;&#x8BE5;&#x5BF9;&#x8C61;&#x3002;
</code></pre>
<h3 id="with"><a name="with" class="anchor-navigation-ex-anchor" href="#with"><i class="fa fa-link" aria-hidden="true"></i></a>1.9.3. with</h3>
<pre><code class="lang-java">&#x5C06;&#x5BF9;&#x8C61;&#x4F5C;&#x4E3A;&#x51FD;&#x6570;&#x7684;&#x53C2;&#x6570;&#xFF0C;&#x5728;&#x51FD;&#x6570;&#x5185;&#x53EF;&#x4EE5;&#x901A;&#x8FC7; <span class="hljs-keyword">this</span>&#x6307;&#x4EE3;&#x8BE5;&#x5BF9;&#x8C61;&#x3002;
&#x8FD4;&#x56DE;&#x503C;&#x4E3A;&#x51FD;&#x6570;&#x7684;&#x6700;&#x540E;&#x4E00;&#x884C;&#x6216;<span class="hljs-keyword">return</span>&#x8868;&#x8FBE;&#x5F0F;
</code></pre>
<h2 id="when"><a name="when" class="anchor-navigation-ex-anchor" href="#when"><i class="fa fa-link" aria-hidden="true"></i></a>1.10. when</h2>
<pre><code class="lang-java">&#x8868;&#x8FBE;&#x5F0F;&#x7C7B;&#x4F3C; java &#x4E2D;&#x7684; <span class="hljs-keyword">switch</span>
</code></pre>
<h3 id="intarrayof"><a name="intarrayof" class="anchor-navigation-ex-anchor" href="#intarrayof"><i class="fa fa-link" aria-hidden="true"></i></a>1.10.1. intArrayOf</h3>
<pre><code class="lang-java">&#x521B;&#x5EFA;&#x4E00;&#x4E2A;<span class="hljs-keyword">int</span>&#x6570;&#x7EC4;
</code></pre>
<h3 id="&#x4F4D;&#x8FD0;&#x7B97;&#x7B26;"><a name="&#x4F4D;&#x8FD0;&#x7B97;&#x7B26;" class="anchor-navigation-ex-anchor" href="#&#x4F4D;&#x8FD0;&#x7B97;&#x7B26;"><i class="fa fa-link" aria-hidden="true"></i></a>1.10.2. &#x4F4D;&#x8FD0;&#x7B97;&#x7B26;</h3>
<pre><code class="lang-java">shl  &#x2014;&#x2014; &#x7C7B;&#x4F3C;Java&#x7684;&lt;&lt;
shr  &#x2014;&#x2014; &#x7C7B;&#x4F3C;Java&#x7684;&gt;&gt;
ushr &#x2014;&#x2014; &#x7C7B;&#x4F3C;Java&#x7684;&gt;&gt;&gt;
and  &#x2014;&#x2014; &#x7C7B;&#x4F3C;Java&#x7684;&amp;
or   &#x2014;&#x2014; &#x7C7B;&#x4F3C;Java&#x7684;|
xor  &#x2014;&#x2014;  &#x540C;Java&#x4E2D;&#x7684;&#x6309;&#x4F4D;&#x5F02;&#x6216; ^
inv  &#x2014;&#x2014; Java&#x4E2D;&#x7684;&#x6309;&#x4F4D;&#x53D6;&#x53CD; -
</code></pre>
<h3 id="companion-object"><a name="companion-object" class="anchor-navigation-ex-anchor" href="#companion-object"><i class="fa fa-link" aria-hidden="true"></i></a>1.10.3. companion object</h3>
<pre><code class="lang-java">Kotlin&#x8BED;&#x8A00;&#x4E2D;&#x4F7F;&#x7528;<span class="hljs-string">&quot;object&quot;</span>&#x4FEE;&#x9970;&#x9759;&#x6001;&#x7C7B;
Kotlin&#x8BED;&#x8A00;&#x4E2D;&#x4F7F;&#x7528;<span class="hljs-string">&quot;companion object&quot;</span>&#x4FEE;&#x9970;&#x9759;&#x6001;&#x65B9;&#x6CD5;
</code></pre>
<h3 id="let"><a name="let" class="anchor-navigation-ex-anchor" href="#let"><i class="fa fa-link" aria-hidden="true"></i></a>1.10.4. let</h3>
<pre><code class="lang-java">&#x5E38;&#x4E0E;&#x975E;&#x7A7A;&#x5224;&#x65AD;&#x7B26;&#x4E00;&#x8D77;&#x4F7F;&#x7528;
compoundDrawables?.let {
  <span class="hljs-comment">//compoundDrawables&#x4E0D;&#x4E3A;&#x7A7A;&#x5C31;&#x6267;&#x884C;...</span>
}
</code></pre>
<h3 id="&#x53CC;&#x5192;&#x53F7;-"><a name="&#x53CC;&#x5192;&#x53F7;-" class="anchor-navigation-ex-anchor" href="#&#x53CC;&#x5192;&#x53F7;-"><i class="fa fa-link" aria-hidden="true"></i></a>1.10.5. &#x53CC;&#x5192;&#x53F7; ::</h3>
<pre><code class="lang-java"><span class="hljs-comment">// &#x8C03;&#x7528;d&#x5BF9;&#x8C61;&#x7684;&#x65B9;&#x6CD5;getResult</span>
d::getResult
</code></pre>
<footer class="page-footer"><span class="copyright">&#x65E0;&#x7248;&#x6743; &#x53EF;&#x4EE5;&#x65E0;&#x9650;&#x5236;&#x4F7F;&#x7528;&#xFF01; all right reserved&#xFF0C;powered by Gitbook</span><span class="footer-modification">&#x8BE5;&#x6587;&#x4EF6;&#x66F4;&#x65B0;&#x65F6;&#x95F4;&#xFF1A;
2019-06-18 13:39:13
</span></footer>
                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../" class="navigation navigation-prev navigation-unique" aria-label="Previous page: 个人信息">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"kotlin基础","level":"1.2","depth":1,"previous":{"title":"个人信息","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-search","search-plus","todo","anchor-navigation-ex","copy-code-button","fontsettings","tbfed-pagefooter","donate","local-video","splitter","favicon","theme-comscore","local-video"],"styles":{"website":"styles/website.css"},"pluginsConfig":{"tbfed-pagefooter":{"copyright":"无版权 可以无限制使用！","modify_label":"该文件更新时间：","modify_format":"YYYY-MM-DD HH:mm:ss"},"todo":{},"splitter":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"donate":{"alipay":"http://oyru0ayig.bkt.clouddn.com/201803011956_osChina_支付宝收款码.png","alipayText":"支付宝打赏","button":"打赏","title":"","wechat":"http://oyru0ayig.bkt.clouddn.com/201803011956_osChina_微信收款码.png","wechatText":"微信打赏"},"fontsettings":{"family":"sans","size":2,"theme":"sepia"},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":true},"favicon":{"shortcut":"assets/images/favicon.ico","bookmark":"assets/images/favicon.ico"},"theme-comscore":{},"local-video":{},"copy-code-button":{},"sharing":{"all":["facebook","google","twitter","weibo","instapaper"],"facebook":true,"google":false,"instapaper":false,"twitter":true,"vk":false,"weibo":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"search-plus":{}},"theme":"default","author":"Aivin","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Aivin开发笔记","language":"zh-hans","gitbook":"*","description":"Aivin开发笔记"},"file":{"path":"chinese/kotlin基础.md","mtime":"2019-06-18T05:39:13.043Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-06-18T08:21:51.977Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-donate/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-local-video/video.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-theme-comscore/test.js"></script>
        
    

    </body>
</html>

